package com.showcai.service;

import com.github.pagehelper.PageInfo;
import com.showcai.module.Certificate;
import com.showcai.module.CertificateBatch;
import com.showcai.module.CertificateUserdLog;
import com.showcai.myRunTime.MyRunTimeExcption;

import java.util.List;
import java.util.Map;

/**
 * 卡券接口
 */
public interface CertificateService {


    /**
     * 获取卡券列表
     *
     * @param map
     * @return
     */
    List<Certificate> getCertificateList(Map<String, String> map) throws MyRunTimeExcption;

    /**
     * 通过userID获取卡券列表
     *
     * @param userId
     * @return
     * @throws MyRunTimeExcption
     */
    List<Certificate> getCertificateListFromPackByUserId(Long userId) throws MyRunTimeExcption;

    void createCertificate(CertificateBatch certificateBatch);

    /**
     * 修改单张卡券
     *
     * @param certificate
     * @return
     */
    Certificate modifyCertificate(Certificate certificate) throws MyRunTimeExcption;



    /**
     * 使用卡券
     * @param certificateId
     * @throws MyRunTimeExcption
     */
    void usedCertificate(String certificateId) throws MyRunTimeExcption;

    /**
     * 获取卡券信息
     *
     * @param certificateId
     * @return
     */
    Certificate getCertificateInfo(String certificateId) throws MyRunTimeExcption;

    /**
     * 获取可以使用的卡券列表
     *
     * @param userId
     * @param productEntityIdList
     * @return
     */
    List<Certificate> getUsedableCertificate(Long userId, List<Long> productEntityIdList) throws MyRunTimeExcption;
    /**
     * 用户获得卡券
     *
     * @param userId
     * @param productEntityId
     * @return
     */
    Certificate userGainCertificate(Long userId, Long productEntityId) throws MyRunTimeExcption;

    /**
     * 获取用户可以获取的卡券列表
     *
     * @return
     */
    List<Certificate> getGetableCertificate() throws MyRunTimeExcption;
    /**
     * 获取卡券使用记录
     *
     * @return
     */
    List<CertificateUserdLog> getCertificateUserdLogList(Map<String, String> map) throws MyRunTimeExcption;
    /**
     * 获取对应卡券信息
     * @param certificateId
     * @return
     */
    Certificate getCertificateByCertificateId(String certificateId);

    /**
     * 分页所有卡券
     * @param map
     * @return
     */
    PageInfo getPageInfoCertificateList(Map<String, String> map);

    /**
     * 激活卡券
     * @param certificateId
     * @param userId
     * @throws MyRunTimeExcption
     */
      void activationCertificate(String certificateId, Long userId) throws MyRunTimeExcption;

    /**
     * 验证卡券
     * @param certificateId
     * @throws MyRunTimeExcption
     */
      void verifyExperience(String certificateId,Long organizationId) throws MyRunTimeExcption;



}
